<template>
    <span>
         <component
                 v-if="html"
                 v-bind:is="dynComponent"
                 v-bind="$props"
                 v-on = "$listeners"
         />
    </span>

</template>
<script>
    export default {
        props:['html'],
        data: function () {
            return {
                code:'',
                data:1111,
            }
        },
        methods: {
            handleDrop(data) {

            },
        },
        computed: {
            dynComponent() {
                const template = this.html ? `<span>`+this.html+`</span>` : '<div>code</div>'
                return {
                    template, // use content as template for this component
                    props: this.$options.props, // re-use current props definitions
                    methods: {
                        //为了防止报错
                        handleDrop() {
                        },
                    }
                }
            }
        }
    }
</script>
